package com.onpositive.dataminer.core;

import java.text.NumberFormat;

import com.onpositive.data.IPropertyConstants;
import com.onpositive.semantic.model.api.property.IProperty;

public class BasicPropertyStats {

	IProperty prop;

	public BasicPropertyStats(IProperty prop) {
		super();
		this.prop = prop;
		Object singleValue = prop.getMeta().getSingleValue(IPropertyConstants.CHAR_SAMPLES_COUNT_LABEL,  Object.class,null);
		if (singleValue!=null){
			samplesCount=Integer.parseInt(singleValue.toString());
		}
		singleValue = prop.getMeta().getSingleValue(IPropertyConstants.CHAR_RATE_LABEL,  Object.class,null);
		if (singleValue!=null){
			rate=Double.parseDouble(singleValue.toString());
		}
		
	}

	protected int samplesCount;

	public int getSamplesCount() {
		return samplesCount;
	}

	public void setSamplesCount(int samplesCount) {
		this.samplesCount = samplesCount;
	}



	protected double rate;

	public String getRate() {
		return NumberFormat.getInstance().format(rate);
	}

	
	public String getTotalRate(){
		return NumberFormat.getInstance().format(rate*samplesCount/DefaultUniverse.getInstance().all().size());
		
	}
}
